package qx.hyj.petrescue.controller;




import jakarta.servlet.http.HttpServletRequest;
import qx.hyj.petrescue.VO.Result;
import qx.hyj.petrescue.param.ConditionParam;
import qx.hyj.petrescue.param.PageModel;
import qx.hyj.petrescue.param.PageParam;

import java.lang.reflect.Type;
import java.util.List;

/**
 * 通用控制器接口
 *
 * @param <T> 实体对象
 * @param <K> 实体主键字段类型
 */
public interface IBaseController<T, K> {

    String getEntityName();

    Class<? extends Type> getEntityClass();

    Result<T> add(T t, HttpServletRequest request);

    Result<T> update(T t, HttpServletRequest request);

    Result<K> delete(K k, HttpServletRequest request);

    Result<T> get(K k, HttpServletRequest request);

    Result<List<K>> deleteBatch(String ids, HttpServletRequest request);

    Result<PageModel<List<T>>> page(PageParam<T> pageParam, HttpServletRequest request);

    Result<List<T>> list(ConditionParam<T> conditionParam, HttpServletRequest request);

}
